export function filterLable(name: string, isNotStage: boolean, value: any) {
  const configObject: any = {
    countRuleCode: "取样规则编码",
    abilityType: "过程质量监控分类",
    ruleLowestNum: "计算样本最低数量",
    ruleLowestDuration: "计算最低取样时长(天)",
    continuousNum: `${isNotStage ? "滚动数量" : "样本节拍比对件数"}`,
    intervalSecond: "节拍比对倍数",
    firstExecutionTime: "首次执行时间",
    intervalHour: "取样间隔（小时）",
    cpkComputeHour: "CPK计算周期（小时）",
    maxRange: "取样最大范围",
    minRange: "取样最小范围",
    rollInterval: "取样范围滚动间隔",
    maxUnit: "取样范围单位",
    sampleNum: "单值图默认节点展示数量",
    isWarn: "是否预警",
    controlRate: "预警触发：连续超过控制限次数",
    upLine: "控制线上限收严比例",
    downLine: "控制线下限收严比例",
    groupingNum: "子组样本数量",
    defaultTall: `过程能力趋势图cpk均高于值`,
    tallStopover: `cpk连续次数`,
    successiveTall: `高于${value}以上`,
    lowStopover: `cpk连续${value}次呈持续下降趋势`,
    defaultLow: `过程能力趋势图cpk均高于值`,
    // showBaoJing: "过程能力趋势图报警设置", // 自定义的设置，针对以上五个填报项
    checkHour: "首次调查时间",
    updateHour: "更新时间",
    escalateStopover: "升级次数",
    enabled: "是否启用",
    memo: "监控描述",
    toolUseType: "检具用途",
    cpkLow: `趋势图中cpk值低于值`,
    ppkLow: `趋势图中ppk值低于值`,
    isEmail: "发送邮件",
    isOrder: "生成工单",
    maxCount: "取样数据集上限",
    shaftSuffixIds: "测量后缀",
    shaftSuffixNames: "测量后缀",
    shaftSuffixCodes: "测量后缀",
  };
  return configObject[name] ?? "";
}

// 两个对象是否相同的浅比较
export function shallowCompare(obj1: any, obj2: any) {
  console.log("shallowCompare", obj1, obj2);
  const differences: any = {};
  const keys = new Set([...Object.keys(obj1), ...Object.keys(obj2)]);
  keys.forEach((key) => {
    if (
      key != "shaftSuffixIds" &&
      key != "shaftSuffixIdsTwo" &&
      key != "shaftSuffixNames" &&
      obj1[key] != obj2[key] &&
      obj2[key] !== null
    ) {
      differences[key] = { value1: obj1[key], value2: obj2[key] };
      differences[key] = { value1: obj1[key], value2: obj2[key] };
    }
  });
  console.log("differences", differences);

  return differences;
}
